<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>性别</title>
  <script src="https://www.jsdelivr.com/package/npm/echarts"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts-en.common.js"></script>
  <style>
    #main {
      margin: 0 auto;
      background-color: #fff;
    }
    body{
      background-color: #ccc;
    }
  </style>
</head>

<body>

  <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
  <div id="main" style="width: 600px;height:400px;"></div>
  <script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    var option2 = {
      tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b}: {c} ({d}%)'
      },
      legend: {
        orient: 'vertical',
        left: 10,
        data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
      },
      series: [
        {
          name: '访问来源',
          type: 'pie',

          radius: '55%',
          center: ['50%', '50%'],
          label: {
            normal: {
              show: true,
              formatter: '{b}:{c}' + '\n\r' + '({d}%)',
              textStyle: {
                fontWeight: 'normal',
                fontSize: 20
              }
            }
          },
          radius: ['50%', '70%'],
          avoidLabelOverlap: false,
          emphasis: {
            label: {
              show: true,
              fontSize: '30',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: true
          },
          data: [
            { value: 34, name: '女' },
            { value: 36, name: '男' }
          ]
        }
      ]
    };

    

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option2);
  </script>

</body>

</html>